package com.sk.bilibili.view.fragment.rank;

import com.alibaba.android.vlayout.DelegateAdapter;
import com.sk.bilibili.R;
import com.sk.bilibili.adapter.vlayout.rank.ThemAdapter;
import com.sk.bilibili.bean.Them;
import com.sk.bilibili.model.fragment.rank.ThemModel;
import com.sk.bilibili.view.activity.ThemActivity;
import com.sk.bilibili.view.fragment.BaseTypeFragment;

import java.util.List;

public class ThemFragment extends BaseTypeFragment<ThemModel>{

    public ThemFragment(Integer typeId) {
        super(typeId);
    }

    private ThemAdapter themAdapter;

    @Override
    protected void initAdapter(DelegateAdapter adapter) {
        themAdapter=new ThemAdapter(getContext(),this);
        adapter.addAdapter(themAdapter);
    }

    @Override
    public void onRefresh() {
        model.refresh(typeId);
    }

    public void refreshSuccess(List<Them> thems) {
        themAdapter.setData(thems);
        cancelRefresh();
    }

    public void onClickThem(Integer id) {
        ThemActivity.start(getContext(),id);
    }

}